package com.itheima.app.controller;

import com.itheima.app.manager.CardsUserManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class CardsUserController {

    @Autowired
    CardsUserManager cardsUserManager;

    @GetMapping("/tanhua/cards")
    public ResponseEntity showCardsUser(){

        //调用manager查询数据 返回
        return cardsUserManager.showCardsUser();
    }

    @GetMapping("/tanhua/{id}/unlove")
    public ResponseEntity userUnLove(@PathVariable Long id){

        System.out.println(id);
        cardsUserManager.unLove(id);
        return ResponseEntity.ok(null);
    }

    @GetMapping("/tanhua/{id}/love")
    public ResponseEntity userLove(@PathVariable Long id){

        cardsUserManager.userLove(id);
        return ResponseEntity.ok(null);

    }
}
